
import * as ActionTypes from '../constants/constants.js';
import { saveData, removeData, loadData } from '../util/utils.js';

// 商家id
// export const shopnum = (state = util.shopnum) => state;

// 我的设备
export const myDevice = (state = null, action) => {
    switch (action.type) {
        case ActionTypes.setMyDevice:
            saveData('myDevice', action.data);
            return state = action.data
        case ActionTypes.clearMyDevice:
            removeData('myDevice')
            return state = null
        default:
            return state;
    }
}

export const statusHeight = (state = 0, action) => {
    switch (action.type) {
        case ActionTypes.setStatusHeight:
            return state = action.data
        default:
            return state;
    }
}

export const userInfo = (state = {}, action) => {
    switch (action.type) {
        case ActionTypes.setUserInfo:
            saveData('userInfo', action.data)
            return action.data
        default:
            return state;
    }
}
